package com.econ.powercloud.ems.common.enums;

/**
 * @ Description:
 * @ Author：hgp
 * @ Create:2022-12-05-10:32
 */
public enum ComputeType implements EnumMethod {
    ADD(1,"加"),
    SUBTRACT(2,"减"),
    MULTIPLICATION(3,"乘"),
    DIVISION(4,"除"),
    STARTTIME(5,"点"),//某个点号在某个时间的值
    ;
    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    ComputeType(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static ComputeType fromCode(int code){
        for(ComputeType type: ComputeType.values()){
            if(type.getCode() == code){
                return type;
            }
        }
        return null;
    }

    public static String getDescFromCode(int code){
        for(ComputeType type: ComputeType.values()){
            if(type.getCode() == code){
                return type.getDesc();
            }
        }
        return null;
    }

}
